package com.huashi.dealer.modular.business.order.param;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.DecimalMin;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * 订单价格修改参数
 *
 * @author 谭陈强
 * @since 2025-08-15
 */
@Data
@Schema(description = "订单价格修改参数")
public class OrderPriceUpdateParam {

    @Schema(description = "修改原因", example = "商品价格调整", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "修改原因不能为空")
    private String reason;

    @Schema(description = "商品价格修改列表")
    private List<GoodsPriceUpdateParam> goods;

    @Schema(description = "运费调整", example = "5.00")
    private BigDecimal expressPriceAdjust;

    @Schema(description = "备注", example = "价格调整说明")
    private String remark;

    /**
     * 商品价格修改参数
     */
    @Data
    @Schema(description = "商品价格修改参数")
    public static class GoodsPriceUpdateParam {

        @Schema(description = "商品ID", example = "1001", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "商品ID不能为空")
        private Long goodsId;

        @Schema(description = "新价格", example = "99.00", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "新价格不能为空")
        @DecimalMin(value = "0.01", message = "价格必须大于0")
        private BigDecimal newPrice;

        @Schema(description = "原价格", example = "89.00")
        private BigDecimal oldPrice;
    }
}
